# -*- coding:utf-8 -*-
# @Time : 2022-2-21 17:53 
# @Author : suny570
# @Site   : 
# @File : semantic_search_hits.py 
# @Software: PyCharm


# 目前数据使用更新去实现的
class SimilaritySearchHits(object):

    def __init__(self, server_handle, model=None):
        self.server_handle = server_handle
        # self.index_name = index_name
        # self.type_name = type_name
        #self.query_json = query_json
        self.model = model

    def update_search_hits(self, index_name, type_name, arr_id, arr_freq):
        all_data = []
        if len(arr_id) == len(arr_freq) and len(arr_id) != 0:
            for arr, freq in zip(arr_id, arr_freq):
                # update_used_id_field_item 或者所有内容重新插入
                if freq == '':
                    freq = 0
                self.server_handle.update_used_id_field_item(index_name, type_name, arr, 'exter_1', freq+1)
            return True
        else:
            return None


